from alipay import AliPay

app_private_key_string = open("./key.txt").read()
app_public_key_string = open("./pub_alipay.txt").read()
a = AliPay(
    appid='2021000119681771',
    app_notify_url=None,
    app_private_key_string=app_private_key_string,
    alipay_public_key_string=app_public_key_string,
    sign_type='RSA2',
    debug=True
)

res = a.api_alipay_trade_page_pay(
    subject="测试支付",
    out_trade_no="2112233",
    total_amount=float(999),  # 只有生成支付宝链接时，不能用Decimal
    return_url='http://192.168.0.198:8080/actual/detail/1',
    notify_url='http://192.168.0.198:8080/actual/detail/1',
)

print("https://openapi.alipaydev.com/gateway.do?" + res)
